package cn.userManager.service.impl;

import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import cn.userManager.mapper.UserMapper;
import cn.userManager.mapper.UserMapperCustom;
import cn.userManager.po.User;
import cn.userManager.po.UserExample;
import cn.userManager.po.UserWithBLOBs;
import cn.userManager.service.UserService;

public class UserServiceImpl implements UserService {
	@Autowired
	private UserMapper userMapper;
	@Autowired
	private UserMapperCustom userMapperCustom;
	@Override
	public void insertUser(User user) throws Exception {
		UserWithBLOBs userblog=new UserWithBLOBs();
		BeanUtils.copyProperties(user, userblog);
		userMapper.insert(userblog);
	}
	@Override
	public User selectByName(String username) throws Exception {
		User user=userMapperCustom.selectByUserName(username);
		return user;
	}
	@Override
	public User selectByPhone(String mobilephone) throws Exception {
		User user=userMapperCustom.selectByUserPhone(mobilephone);
		return user;
	}

}
